#!/usr/bin/env bash

WFSXML_IN=be16.a4.6.opt.wfs.xml 
vmc_blocks=100
dmc_blocks=250
let dmc_samples=96*$vmc_blocks
dmc_dt=0.02

mytag=`date +"%m-%d-%y_%H%M"`

if [ -n "$1" ]
then
  mytag=$1
fi   

echo "Generating input with the root", $mytag

rm -rf multiple.list
touch multiple.list
for twist in 0 1 2 3 4 5 6 7; do
  title="be16."k$twist.$mytag
  WFSXML=be16.a4.6.k$twist.wfs.xml
  sed s/TWIST/$twist/ $WFSXML_IN > $WFSXML

  cat qmc.xml\
  | sed s/TITLE/$title/ \
  | sed s/WFSXML/$WFSXML/ \
  | sed s/VMCBLOCKS/$vmc_blocks/ \
  | sed s/VMCSTEPS/10/ \
  | sed s/WALKERS/1/ \
  | sed s/SAMPLES/$dmc_samples/ \
  | sed s/DMCBLOCKS/$dmc_blocks/ \
  | sed s/TIMESTEP/$dmc_dt/ \
  > $title.xml

  echo $title.xml >> multiple.list
done
